<template>
  <div style="margin-top: 90rpx">
    <div>
      <u-button type="primary" @click="register" text="点击注册"></u-button>
    </div>
    <div style="margin-top: 40rpx">
      <u-button type="primary" @click="login" text="点击登录"></u-button>
    </div>
    <!-- <u-button type="warning" text="开始聊天"></u-button> -->
  </div>
</template>
<script>
import store from '@/store'
export default {
  name: '',
  data() {
    return {}
  },
  methods: {
    register() {
      console.log('注册')
      store.dispatch('Iregister')
    },
    login() {
      uni.login({
        provider: 'weixin',
        success: async (loginRes) => {
          await store.dispatch('wxLogin', {
            JsCode: loginRes.code.toString(),
            InvitationUID: +this.id || 0,
          })
        },
      })
    },
  },
}
</script>
<style lang="scss" scoped></style>
